package com.zst.demo2.converter;

import com.zsr.entities.UserDTO;
import com.zst.demo2.po.UserPO;

import java.util.Objects;

public class UserConverter {
    /**
     * UserPO -> UserDTO
     *
     * @param po
     * @return
     */
    public static UserDTO convert2UserDTO(UserPO po) {
        UserDTO res = new UserDTO();
        if (Objects.nonNull(po)) {
            res.setId(po.getId());
            res.setUsername(po.getUsername());
            res.setPassword(po.getPassword());
            res.setMobile(po.getMobile());
            res.setGmtCreated(po.getGmtCreated());
            res.setGmtModified(po.getGmtModified());
        }
        return res;
    }
}
